// MatrixChain.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "MatrixUtil.h"
/*
int main()
{
	//char strInput[10000] = "matrix(5,7)*matrix(7,7)*matrix(7,8)*matrix(8,9)*matrix(9,2)*matrix(2,4)*matrix(4,9)*matrix(9,5)*matrix(5,4)*matrix(4,1)";
	char strInput[10000] = "matrix(3,3)*matrix(3,3)";
	string text;
	text = "matrix(3,3,[-362,-385,-408,570,675,780,-362,-301,-240])*matrix(3,1,[1,2,3])*matrix(1,4,,[4,5,6,7])";
	MatrixUtil * aMatrixUtil;
	aMatrixUtil = new MatrixUtil(strInput);	
	switch(aMatrixUtil->iErrorCode)
	{
	case -1:
		cout<<"Input string is wrong format";
		return 0;
		break;
	case -2:
		cout<<"The size is not fitable";
		return 0;
		break;
	case -3:
		cout<<"The Quantity is over than 1000";
		return 0;
		break;
	}

	aMatrixUtil->MatrixChainOrder(aMatrixUtil->iSIZE);
	aMatrixUtil->Print_M1();
	string result = aMatrixUtil->PrintParenthese(0,aMatrixUtil->iSIZE-2,1,aMatrixUtil->iSIZE-1);
	cout<<"-----------------------------------------------------------"<<endl;
	cout<<"Optimize parenthese ="<<result<<endl;
	cout<<"-----------------------------------------------------------"<<endl;
	int normalCost = aMatrixUtil->NormalCost();
	cout<<"Normal cost = "<<normalCost<<endl;
	cout<<"-----------------------------------------------------------"<<endl;
	int optimizeCost = aMatrixUtil->OptimizeCost();
	cout<<"Optimize cost = "<<optimizeCost<<endl;


	cout<<"---------------------------example for option 1--------------------------------"<<endl;
	aMatrixUtil->processCommand(text);
	switch(aMatrixUtil->iErrorCode)
	{
	case aMatrixUtil->TheSizeNotFitable:
		cout<<"The size is not fitable at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	case aMatrixUtil->InputStringIsNull:
		cout<<"Input string is null";
		return 0;
	case aMatrixUtil->MissingKeywordMatrixForEntry:
		cout<<"MissingKeywordMatrixForEntry at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	case aMatrixUtil->MissingOpeningParenthesisForMatrix:
		cout<<"MissingOpeningParenthesisForMatrix at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	case aMatrixUtil->MissingClosingParenthesisForMatrix:
		cout<<"MissingClosingParenthesisForMatrix at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	case aMatrixUtil->MissingTheFirstComma:
		cout<<"MissingTheFirstComma at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	case aMatrixUtil->RowCannotBe0ForMatrix:
		cout<<"RowCannotBe0ForMatrix at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	case aMatrixUtil->MissingSecondComma:
		cout<<"MissingSecondComma at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	case aMatrixUtil->ColumnCannotBe0ForMatrix:
		cout<<"ColumnCannotBe0ForMatrix at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	case aMatrixUtil->MissingOpeningBracketForMatrix:
		cout<<"MissingOpeningBracketForMatrix at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	case aMatrixUtil->MissingClosingBracketForMatrix:
		cout<<"MissingClosingBracketForMatrix at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	case aMatrixUtil->TooFewEntriesForMatrix:
		cout<<"TooFewEntriesForMatrix at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	case aMatrixUtil->SyntaxErrorInExpressionAfterMatrix:
		cout<<"SyntaxErrorInExpressionAfterMatrix at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	case aMatrixUtil->MissingAtTheRow:
		cout<<"MissingAtTheRow at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	case aMatrixUtil->MissingAtTheCol:
		cout<<"MissingAtTheCol at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	case aMatrixUtil->TheNumberInMatrixError:
		cout<<"TheNumberInMatrixError at sequence: "<<aMatrixUtil->iSequenceNumber<<endl;
		return 0;
	}
	//aMatrixUtil->matrix_chain_multiply();
    return 1;
}
*/